import React, { Component } from 'react'
import { shopcarlist } from '../api/index'


export default class Order extends Component {
    componentDidMount() {
        this.getlist()
    }

    getlist = () => {
        shopcarlist().then(res => {
            this.setState({
                shopcarlist: res.data.data,
            })
        })
    }

    state = {
        shopcarlist: []
    }
    render() {
        const { shopcarlist } = this.state;

        return (
            <div className='order'>
                  <div className="order_header">
                    <p onClick={() => { this.props.history.goBack() }}>&lt;&nbsp;返回</p>
                    <p>全部订单</p>
                    <p></p>
                </div>
                <div className="order_main">
                    {
                        shopcarlist ? shopcarlist.map((item, index) => {
                            return <dl key={index}>
                                <dt>
                                    <img src={item.img} alt="" />
                                </dt>
                                <dd>
                                    <p>
                                        {item.title}
                                    </p>
                                    <p>
                                        {item.price}￥
                                </p>
                                </dd>
                            </dl>
                        }) : null
                    }
                </div>

            </div>
        )
    }
}
